
//导入request.js 工具
import request from "@/utils/request";

//公告列表分页查询
export const noticeListService = (params) => {
  return request.get('/notice/findPageAll',{params:params});//两个params ，前面的是固定的，后面是自己传的参数
};
export const noticeFindAllService= () =>{
   return request.get('/notice/findAll');
}
  
//公告添加提交
export const noticeAddService = (noticeData) => {
  return  request.post('/notice/add',noticeData);//直接将数据以json的格式传输进去 
};

//公告修改提交
export const noticeUpdateService = (noticeData) => {
  return  request.put('/notice/update',noticeData);
};
//删除公告
export const noticeDeleteService = (id) => {
  return  request.delete('/notice/delete?id='+id);
};
//批量删除公告
export const noticeBatchDeleteService = (multipleSelection) => {
  return request.put('/notice/batchDelete', multipleSelection );
};
export const expNoticeServer =()=>{
  return request({
    url: "/notice/export",
    method: 'get',
    responseType: 'blob' // 设置响应类型为blob
  });
}
export const NoticeUploadService= (file) => {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: "/notice/upload",
    method: 'post',
    data: formData, // 使用 data 而不是 formData
    headers: {
      'Content-Type': undefined // 让 axios 自动设置 Content-Type
    }
  });
};